let common = {
    state: {
        crums: [],
        ULFB: [],
        ULFE: [],
        imgUrl: 'http://192.168.1.39:7777',
        QueryStaff: [],
        QuerySupplier: [],
    },
    mutations: {
        SET_CRUMS(state, crums) {
            state.crums = crums
        },
        SET_ULFB(state, ulfb) {
            state.ULFB = ulfb
        },
        SET_ULFe(state, ulfe) {
            state.ULFE = ulfe
        },
        SET_QUERYSTAFF(state, list) {
            state.QueryStaff = list
        },
        SET_QUERYSUPPLIER(state, list) {
            state.QuerySupplier = list
        },
        // store分模块导入时只有state是跟着一起分模块的 其他默认都是全局除非使用了设置namespaced: true,
        Setfunname(state, payload) {
            let name = payload.MN;
            let arr = ['Purchasingmanagement','Humanmanage',"Managements", 'Permission', 'Materia', 'Common'];
            for (let index = 0; index < arr.length; index++) {
                let item = arr[index];
                if (this.state[item].MNvalue && this.state[item].MNvalue[name]) {
                    this.state[item].MNvalue[name] = payload;
                    return
                } else if (this.state[item] && this.state[item][name]) {
                    this.state[item][name] = payload;
                    return
                } else {
                    continue
                }
            }
        }
    },
    actions: {
        setCrums({ commit }, crums) {
            commit('SET_CRUMS', crums)
        },
        setUlfb({commit}, ulfb) {
            commit('SET_ULFB', ulfb)
        },
        setUlfe({commit}, ulfe) {
            commit('SET_ULFE', ulfe)
        },
        setQueryStaff({commit}, staff) {
            commit('SET_QUERYSTAFF', staff)
        },
        setQuerySupplier({commit}, staff) {
            commit('SET_QUERYSUPPLIER', staff)
        },
        setQueryJobs({commit}, staff) {
            commit('SET_QUERYJOBS', staff)
        },
        setQueryOrganization({commit}, staff) {
            commit('SET_QUERYORGANIZATION', staff)
        },
    }
}

export default common
